package com.example.demo.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@AllArgsConstructor
@NoArgsConstructor
@Data
public class Result<T> {
    private T data;

    private Integer code;

    private String msg;

    public static <T> Result<T> success(String msg, T data) {
        return new Result<>(data, 200, msg);
    }

    public static Result error(String msg, Integer code){
        return new Result<>(null, code, msg);
    }
}
